home *** CD-ROM | disk | FTP | other *** search
- /*RX
- * AREXX Name:Start_TeX.ged Version:2.00 Date:28-Feb-94
- *
- This AREXX script saves and compiles the current GoldED window. The only
- (optional) argument is the format to be used. A '?' formatname will
- interactively ask for the format to use.
- *
- A command is send to the TeX server to compile the file. Hence a
- return value of 0 does not mean that the file compiled well, but only
- that the command was sent to the server and replied to.
- *
- AUTHOR:
- * René Laederach, February 94
- *
- BUGS:
- virtex doesn't like filenames with blanks (and ARexx parses them
- hardly too), so avoid them in file, directory *and* device names.
- *
- Does not like names relative to the local root, like ":foo/bar"
- Although I can't think GoldED will ever do that.
- *
- FILES:
- ENV:TEXFORMAT: default format used
- REXX:namestruc
- *
- Done by:
-
- R.Laederach
- Kappelisackerstr. 46
- 3063 Ittigen
- Switzerland
- Phone:+41/(0)31/912 19 08
-
- This stuff ist PostcardWare, so send me a postcard or something useful (read
- the doc!).
- */
-
- /* $VER: 0.9, ©1993 Dietmar Eilert. Empty GoldED macro */
-
- OPTIONS RESULTS /* enable return codes */
-
- if (LEFT(ADDRESS(), 6) ~= "GOLDED") then /* not started by GoldEd ? */
- address 'GOLDED.1'
-
- 'LOCK CURRENT' /* lock GUI, gain access */
- OPTIONS FAILAT 6 /* ignore warnings */
- SIGNAL ON SYNTAX /* ensure clean exit */
-
- portname = 'Start_TeX'
- script = 'TeX-server.rexx' /* no path required, message only */
-
- IF "" = GETCLIP("TEXQUERY") THEN askformat = 0
- ELSE askformat = 1 /* ask interactively for format name */
-
- PARSE ARG format .
- IF "?" = format THEN DO
- askformat= 1
- format = ""
- END
- ELSE IF '&' = LEFT(format,1) THEN
- format = SUBSTR(format,2)
-
- 'QUERY DOC' /* full filename */
- filename=RESULT
-
-
- IF "" == filename | UPPER(RIGHT(filename,3)) ~= "TEX" THEN DO
- 'REQUEST TITLE="Beware!" BODY="Sorry, filename must have an extension and end in .tex."'
- UNLOCK
- EXIT 5
- END
-
- 'QUERY MODIFY'
-
- if (RESULT = 'TRUE') THEN DO
- 'SAVE ALL'
- END
-
- IF (SHOW('P', portname)) THEN DO
- /* set the default format, modify it to suit your needs */
- envformat = mygetenv("TEXFORMAT")
- IF "" == format THEN DO
- format = envformat
- IF askformat | "" = envformat THEN DO
- IF "" = format THEN format = 'plain'
-
- 'REQUEST TITLE="Question!" BODY="Which format to use ?" STRING VAR NFORMAT'
- IF "RESULT" ~= nformat THEN format = nformat
-
- END /* askformat */
- END /* format */
-
- if format ~= envformat THEN CALL mysetenv("TEXFORMAT",format)
-
- 'UNLOCK'
- ADDRESS VALUE portname
- 'compile' format filename
- EXIT 0 /* Do it here to avoid multiple "Waiting for command..." messages in TeX server window */
- END
- ELSE DO
- /* The TeX server must be started first */
- 'REQUEST TITLE="Warning!" BODY="The TeX server script is not running !"'
- UNLOCK
- EXIT 5
- END
-
- 'UNLOCK' /* VERY important: unlock GUI */
-
- EXIT
-
- SYNTAX:
-
- SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
- 'UNLOCK'
- EXIT
-
- mygetenv: procedure /* when will ARexx supply GetEnv/SetEnv ? */
- PARSE ARG name
-
- IF open(TEMPFILE,"ENV:"||name,'r') THEN DO
- gives = readln(TEMPFILE)
- CALL close TEMPFILE
- END
- ELSE gives = ""
-
- RETURN gives
-
- mysetenv: procedure
- PARSE ARG name,content
-
- ADDRESS COMMAND "SetEnv" name content
-
- RETURN
-
-